//
//  TransitionType.swift
//  CustomTransition
//
//  Created by CaryaLiu on 2021/10/14.
//

import UIKit

enum TransitionType {
    enum Direction {
        case up, down, left, right
    }

    case slide(direction: Direction, operation: UINavigationController.Operation)
    
    func operation() -> UINavigationController.Operation {
        switch self {
        case .slide(_, let operation):
            return operation
        }
    }
}


extension TransitionType {
    func transitionAnimator() -> UIViewControllerAnimatedTransitioning? {
        TransitionAnimator.create(with: self)
    }
}
